package cn.com.wangluotongxin.admin.model.constants;

public enum UserLevel {

    COMMON(1, "普通账号"),
    ADMIN(2, "管理账号");

    private Integer code;

    public Integer getCode() {
        return code;
    }

    private String name;

    public String getName() {
        return name;
    }

    public static UserLevel getByCode(Integer code){
        if(code == null){
            return null;
        }else {
            UserLevel[] userLevels = values();
            for(UserLevel userLevel : userLevels){
                if(userLevel.getCode().equals(code)){
                    return userLevel;
                }
            }
        }
        return null;
    }

    UserLevel(Integer code, String name){
        this.code = code;
        this.name = name;
    }
}
